package Database.Keys
{
	import flash.data.*;
	
	public class DatabaseKey
	{
		private var _isPrimary:Boolean;
		private var _name:String;
		private var _value:*;
		private var _type:String;
		
		public function DatabaseKey(name:String,value:*,type:String,isPrimary:Boolean)
		{
			_isPrimary = isPrimary;
			_name = name;
			_value = value;
			_type = type;
		}
		
		public function get isPrimary():Boolean{return _isPrimary;}
		public function get name():String{return _name;}
		public function get value():*{var str:String=_value; if(type=="varchar") str="\'"+_value+"\'";return str;}
		public function get type():String{return _type;}
		public function get queryString():String
		{
			var str:String = _name+" "+_type;
			if(_isPrimary)
				str += " NOT NULL PRIMARY KEY";
			return str;
		}
	}
}